package com.huawei.appmarket.framework.startevents.roam;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import com.huawei.appgallery.foundation.ui.framework.activity.BaseActivity;
import o.cjk;
import o.cjm;
import o.diy;
import o.RoamDataManager;
import o.dkk;
import o.dko;
import o.Logger;
import o.ContentManager;
import o.eua;
import o.ewm.h;
import o.ewm.j;
import o.FragmentTransaction;

public class RoamActivity extends BaseActivity<RoamActivityProtocol> {
    public static void ˏ(Context context) {
        cjm o_cjm = new cjm("roam.activity", new RoamActivityProtocol());
        if (!(context instanceof Activity)) {
            o_cjm.ॱ().setFlags(268435456);
        }
        cjk.ˎ().ˋ(context, o_cjm);
    }

    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        if (getActionBar() != null) {
            getActionBar().hide();
        }
        dko o_dko = new dko();
        o_dko.ˏ(20161007);
        dkk.ˊ(ContentManager.getInstant().getContext(), o_dko).ॱ();
        Logger.ˎ("RoamActivity", "clear notification.");
        String ॱ = eua.ˏ().ॱ("physical_address", "");
        eua.ˏ().ˊ(ॱ + eua.ˏ().ॱ("roam_time", 0), 1);
        setContentView(h.ˊꜟ);
        ᐝ();
    }

    public void onDestroy() {
        super.onDestroy();
    }

    private void ᐝ() {
        RoamActivityProtocol roamActivityProtocol = (RoamActivityProtocol) ʾ();
        if (roamActivityProtocol == null) {
            Logger.ˋ("RoamActivity", "error,protocol is null");
            finish();
            return;
        }
        Fragment ˊ = cjk.ˎ().ˊ(new cjm(roamActivityProtocol.ˎ(), new RoamFragmentProcol()));
        if (ˊ == null) {
            Logger.ˋ("RoamActivity", "error,roamFragment is null");
            finish();
            return;
        }
        try {
            FragmentTransaction ˊ2 = ˏॱ().ˊ();
            ˊ2.ˏ(j.ꜟͺ, ˊ, "roam.fragment");
            ˊ2.ˋ();
        } catch (IllegalStateException e) {
            Logger.ˋ("RoamActivity", "Show roamFragment IllegalStateException!");
        } catch (ArrayIndexOutOfBoundsException e2) {
            Logger.ˋ("RoamActivity", "Show roamFragment ArrayIndexOutOfBoundsException!");
        }
    }

    public void onActivityResult(int i, int i2, Intent intent) {
        super.onActivityResult(i, i2, intent);
        if (1002 == i) {
            RoamDataManager.build();
            RoamDataManager.destory();
            diy.ˊ().ˏ();
            finish();
        }
    }
}
